package com.googlecode.flealancemarket.metamodel.beans;

import com.googlecode.flealancemarket.core.beans.BaseBean;
import com.googlecode.flealancemarket.metamodel.PrivateMessage;
import com.googlecode.flealancemarket.metamodel.User;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;

@Entity
public class PrivateMessageBean extends BaseBean implements PrivateMessage {

    private User receiver;
    private User sender;
    private Calendar sendTime;
    private String title;
    private String content;
    private boolean read;

    @ManyToOne(targetEntity=UserBean.class, fetch = FetchType.EAGER)
    @JoinColumn(name = "RECEIVER__ID")
    public User getReceiver() {
        return receiver;
    }

    public void setReceiver(User receiver) {
        this.receiver = receiver;
    }

    @ManyToOne(targetEntity=UserBean.class, fetch = FetchType.EAGER)
    @JoinColumn(name = "SENDER__ID")
    public User getSender() {
        return sender;
    }

    public void setSender(User sender) {
        this.sender = sender;
    }
    @Temporal(javax.persistence.TemporalType.DATE)
    public Calendar getSendTime() {
        return sendTime;
    }

    public void setSendTime(Calendar sendTime) {
        this.sendTime = sendTime;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public boolean getRead() {
        return read;
    }

    public void setRead(boolean read) {
        this.read = read;
    }

    public PrivateMessageBean(){}

}